<?php
class CUser_info {
	static function   show($userid){
                global $pageContent, $page, $user,$topic;
                if ($_SESSION['username']){
                    $info = $user->get_user_info($userid);
                    $xtpl = new XTemplate('home.html',PAGE_PATH.DS.DS.$page.DS.DS.'tpl');
                    $xtpl->assign('USERNAME', $info["username"]);
                    $xtpl->assign('DISPLAYNAME', $info["displayname"]);
                    $xtpl->assign('USERID', $info["id"]);
                    $xtpl->assign('GROUP', $user->get_group_name($info["usergroups_id"]));
                    $ext_content = "";
                    if($info["usergroups_id"]==2){
                        $xtpl->assign('DHT',$info["diemhoctap"]);
                        $xtpl->assign('DRL',$info["diemrenluyen"]);
                        $xtpl->assign('INFO',$info["sinhvien_info"]);
                        $xtpl->assign('TOPIC',$topic->get_name_by_id($info["detai_id"]));
                        $xtpl->parse( 'sinhvien' );
                        $ext_content = $xtpl->text('sinhvien');                        
                    }else if($info["usergroups_id"]==1){                        
                        $xtpl->assign('INFO',$info["giaovien_info"]);                        
                        $xtpl->parse( 'giaovien' );
                        $ext_content = $xtpl->text('giaovien');
                    }
                    $link = '<a href="?page=admin&act=edituser&userid='.$userid.'" class="link">Edit information</a>';
                    $xtpl->assign('LINKS',$link);
                    $xtpl->assign('EXT', $ext_content);
                    $xtpl->parse( 'main' );

                    $pageContent= $xtpl->text('main');
                }else{
                    $pageContent = '<div id="msg" style="display:block;">No infomation found!</div>';
                }
        
	}

        static function edit($userid){
           global $pageContent;
           $pageContent = "Thích sửa thì sửa;";
        }

}
?>